<!DOCTYPE html>
<html>
<link rel="stylesheet" href="resources/link-highlight-style.css">
<body onload="runTest();">
<div style="position: relative; left: 10px; top: 40px">
<a href="" id="targetLink" style="-webkit-tap-highlight-color: rgba(0, 255, 0, 0.5)">Target Link.</a>
</div>
<!-- For this test to work, we must put "will-change: transform" on a div other
     than the one containing the highlighted link. This will force the highlight
     into the non-composited content host, which may survive the navigation. -->
<div style="position: relative; left: 10px; top: 70px; will-change: transform;">
This test is not successful if this message appears.
</div>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<script>
function runTest() {
    var clientRect = document.getElementById('targetLink').getBoundingClientRect();
    x = (clientRect.left + clientRect.right) / 2;
    y = (clientRect.top + clientRect.bottom) / 2;
    if (window.testRunner)
        testRunner.waitUntilDone();

    if (window.eventSender) {
        eventSender.gestureShowPress(x, y);
        // Force display of highlight before navigating to second page.
        runAfterLayoutAndPaint(function() {
            window.location = 'resources/gesture-tapHighlight-simple-navigate-destination.html';
            runAfterLayoutAndPaint(function() {
                testRunner.notifyDone();
            });
        });
    } else {
        debug("This test requires DumpRenderTree.");
    }
}
</script>
</body>
</html>
